package cn.test.dubbo.provider.service.impl;

import java.util.Random;

import com.alibaba.dubbo.config.annotation.Service;
import com.alibaba.dubbo.rpc.service.EchoService;

import cn.test.dubbo.provider.service.DemoService;

/**
 * @author Han
 */
@Service
public class DemoServiceImpl extends EchoServiceImpl implements DemoService{
	@Override
	public String helloworld(String name) {
		System.out.println(name+",执行...");
		return name+",hello world";
	}

	@Override
	public String asyncMethod() {
		try {
			Thread.sleep(2000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		return "这是一个异步方法的调用";
	}

	@Override
	public Integer asyncMethod(int i) {
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		return 3;
	}

	@Override
	public String noreturn() {
		try {
			Thread.sleep(2000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		System.out.println("这个不需要返回值");
		return "呵呵呵呵";
	}

	@Override
	public int random() {
		return new Random().nextInt(100);
	}
}
